package info.ask4research.model.toolsAndMaterials;

import info.ask4research.model.roles.Role;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@DiscriminatorValue("ANNOUNCEMENTSERVICE")
@JsonAutoDetect
public class AnnouncementService extends ToolAndMaterial {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6363842374730967119L;
	@OneToOne
	private Role manager;
	@OneToOne
	private Role moderator;
	@LazyCollection(LazyCollectionOption.FALSE)
    @ManyToMany
    @JoinTable(name="PARTICIPANTS",  joinColumns= @JoinColumn(name="role_ID", referencedColumnName="tam_ID"))
	private List<Role> participants = new ArrayList<Role>();
	@LazyCollection(LazyCollectionOption.FALSE)
	@ManyToMany
    @JoinTable(name="OBSERVERS",  joinColumns= @JoinColumn(name="role_ID", referencedColumnName="tam_ID"))
	private List<Role> observers = new ArrayList<Role>();
	

	public Role getManager() {
		return manager;
	}
	public void setManager(Role manager) {
		this.manager = manager;
	}
	public Role getModerator() {
		return moderator;
	}
	public void setModerator(Role moderator) {
		this.moderator = moderator;
	}
	public List<Role> getParticipants() {
		return participants;
	}
	public void setParticipants(List<Role> participants) {
		this.participants = participants;
	}
	public List<Role> getObservers() {
		return observers;
	}
	public void setObservers(List<Role> observers) {
		this.observers = observers;
	}

}
